<!-- 年龄确认弹框 会员 -->
<template>
  <modal :visible="visible" position="center">
    <view class="age-check-modal">
      <view class="content">
        <view class="title">请确认您已满18周岁？</view>
        <view class="desc">内容涉及酒类知识及其他相关信息</view>
        <view class="btn-wrap">
          <view @click="onCancel" class="common-btn solid btn">
            退出
          </view>
          <view @click.stop="onConfirm" class="common-btn btn">确认</view>
        </view>
      </view>
			<image :src="imgSrc" class="top-img" mode="widthFix" />
    </view>
  </modal>
</template>

<script>
  import modal from "../modal/modal.vue";
  import {
    estImg
  } from "./static";
  import RegisterTracker from "./RegisterTracker";

  export default {
    components: {
      modal
    },
    props: {
      // 使用页面
      location: {
        type: String,
        default: "home",
      },
      // 有的话, 就判定为ts活动
      tsActId: {
        type: String,
        default: "",
      },
    },
    data() {
      return {
        visible: false,
        imgSrc: estImg,
        loading: false,
      };
    },
    methods: {
      open() {
        this.visible = true;
      },
      close() {
        this.visible = false;
      },
      onCancel() {
        let trackParams = {
           c_age_answer: '拒绝'
        }
        RegisterTracker.authGate({
          trackParams,
          location: this.location,
          registerType: this.tsActId ? "TARGET_SALES" : "NORMAL",
        });
        this.$commonSensors.popupEvent('PopupClick', {'popup_type' : '用户授权', 'popup_name': '18岁弹窗', 'button_name': '未满18周岁'})
        wx.exitMiniProgram({
          complete: (com) => {

          },
        });
      },
      onConfirm() {
        let trackParams = {
          c_age_answer: '允许'
        }
        RegisterTracker.authGate({
          trackParams,
          location: this.location,
          registerType: this.tsActId ? "TARGET_SALES" : "NORMAL",
        });
        this.close();
        this.$emit("confirm");
      },
    },
  };
</script>

<style lang="scss">
  @import "./common.scss";

  .age-check-modal {
    width: 654rpx;
    background: #fff;

    .top-img {
      display: block;
      width: 100%;
	  height: 206rpx;
    }

    .content {
      color: #000;
      text-align: center;
      padding-bottom: 96rpx;
    }

    .title {
      padding-top: 128rpx;
      font-size: 36rpx;
      line-height: 52rpx;
      font-weight: 500;
	  color: #000000;
	  // font-family:'NotoSansSC-Regular'
		font-family:'NotoSansSC-Medium';
    }

    .desc {
      margin-top: 20rpx;
      font-size: 28rpx;
	  color: #757575;
      line-height: 48rpx;
			font-weight: 400;
	  font-family:'NotoSansSC-Regular'
    }

    .btn-wrap {
      margin-top: 80rpx;
      box-sizing: border-box;
      padding: 0 64rpx;
      display: flex;
      justify-content: space-between;
    }
  }
</style>
